package SSCLIB.SST2.PWD;

import SSCLIB.*;

//heutai login 
public class SecurityZ8
{
	private String sKey = "88312753";

	public final String Decrypt(String pToDecrypt)
	{
		DESCryptoServiceProvider provider = new DESCryptoServiceProvider();
//C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java:
//ORIGINAL LINE: byte[] buffer = new byte[pToDecrypt.Length / 2];
		byte[] buffer = new byte[pToDecrypt.length() / 2];
		for (int i = 0; i < (pToDecrypt.length() / 2); i++)
		{
			int num2 = (int)(pToDecrypt.substring(i * 2, i * 2 + 2), 0x10);
//C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java:
//ORIGINAL LINE: buffer[i] = (byte) num2;
			buffer[i] = (byte) num2;
		}
		provider.Key = Encoding.ASCII.GetBytes(this.sKey);
		provider.IV = Encoding.ASCII.GetBytes(this.sKey);
		MemoryStream stream = new MemoryStream();
		CryptoStream stream2 = new CryptoStream(stream, provider.CreateDecryptor(), CryptoStreamMode.Write);
		stream2.Write(buffer, 0, buffer.length);
		stream2.FlushFinalBlock();
		StringBuilder builder = new StringBuilder();
		return Encoding.Default.GetString(stream.ToArray());
	}

	public final String Encrypt(String pToEncrypt)
	{
		DESCryptoServiceProvider provider = new DESCryptoServiceProvider();
//C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java:
//ORIGINAL LINE: byte[] bytes = Encoding.Default.GetBytes(pToEncrypt);
		byte[] bytes = Encoding.Default.GetBytes(pToEncrypt);
		provider.Key = Encoding.ASCII.GetBytes(this.sKey);
		provider.IV = Encoding.ASCII.GetBytes(this.sKey);
		MemoryStream stream = new MemoryStream();
		CryptoStream stream2 = new CryptoStream(stream, provider.CreateEncryptor(), CryptoStreamMode.Write);
		stream2.Write(bytes, 0, bytes.length);
		stream2.FlushFinalBlock();
		StringBuilder builder = new StringBuilder();
//C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java:
//ORIGINAL LINE: foreach (byte num in stream.ToArray())
		for (byte num : stream.ToArray())
		{
			builder.append(String.format("%02X", num));
		}
		builder.toString();
		return builder.toString();
	}

	public final String getSecurityKey()
	{
		return this.sKey;
	}
	public final void setSecurityKey(String value)
	{
		this.sKey = value;
	}
}